 
/**
  * @file tuple.h
  * < tuple >
  * 
  * Copyright (c) by <lid/>
  * @author jingwei.guan@hotmail.com
  * modify history:
  * date     version     author     content
  * 1/8/2011  0.0.1       lid       tiny tuple
 */

#ifndef _a78ec1d4_d112_433e_b74f_72ffbee7f1dd__TUPLE_H__
#define _a78ec1d4_d112_433e_b74f_72ffbee7f1dd__TUPLE_H__

#include "traits.h"

namespace tuple
{

	template <typename A=void, typename B=void, typename C=void,
			  typename D=void, typename E=void, typename F=void,
		      typename G=void, typename H=void>
	struct Tuple 
	{
		Tuple(){}
		Tuple(typename traits::add_const_reference<A>::Result a_,
			typename traits::add_const_reference<B>::Result b_,
			typename traits::add_const_reference<C>::Result c_,
			typename traits::add_const_reference<D>::Result d_,
			typename traits::add_const_reference<E>::Result e_,
			typename traits::add_const_reference<F>::Result f_,
			typename traits::add_const_reference<G>::Result g_,
			typename traits::add_const_reference<H>::Result h_)
			: a(a_), b(b_), c(c_), d(d_), e(e_), f(f_), g(g_), h(h_) {}

		void copy(typename traits::add_const_reference<A>::Result a_,
			typename traits::add_const_reference<B>::Result b_,
			typename traits::add_const_reference<C>::Result c_,
			typename traits::add_const_reference<D>::Result d_,
			typename traits::add_const_reference<E>::Result e_,
			typename traits::add_const_reference<F>::Result f_,
			typename traits::add_const_reference<G>::Result g_,
			typename traits::add_const_reference<H>::Result h_)
		{
			a = a_;
			b = b_;
			c = c_;
			d = d_;
			e = e_;
			f = f_;
			g = g_;
			h = h_;
		}
		A a;
		B b;
		C c;
		D d;
		E e;
		F f;
		G g;
		H h;
	};

	template <typename A, typename B, typename C,typename D, typename E, typename F,typename G>
	struct Tuple<A, B, C, D, E, F, G,void>
	{
		Tuple(){}
		Tuple(typename traits::add_const_reference<A>::Result a_,
			typename traits::add_const_reference<B>::Result b_,
			typename traits::add_const_reference<C>::Result c_,
			typename traits::add_const_reference<D>::Result d_,
			typename traits::add_const_reference<E>::Result e_,
			typename traits::add_const_reference<F>::Result f_,
			typename traits::add_const_reference<G>::Result g_)
			: a(a_), b(b_), c(c_), d(d_), e(e_), f(f_), g(g_) {}

		void copy(typename traits::add_const_reference<A>::Result a_,
			typename traits::add_const_reference<B>::Result b_,
			typename traits::add_const_reference<C>::Result c_,
			typename traits::add_const_reference<D>::Result d_,
			typename traits::add_const_reference<E>::Result e_,
			typename traits::add_const_reference<F>::Result f_,
			typename traits::add_const_reference<G>::Result g_)
		{
			a = a_;
			b = b_;
			c = c_;
			d = d_;
			e = e_;
			f = f_;
			g = g_;
		}

		A a;
		B b;
		C c;
		D d;
		E e;
		F f;
		G g;
	};

	template <typename A, typename B, typename C,typename D, typename E, typename F>
	struct Tuple <A, B, C, D, E, F, void,void>
	{
		Tuple(){}
		Tuple(typename traits::add_const_reference<A>::Result a_,
			typename traits::add_const_reference<B>::Result b_,
			typename traits::add_const_reference<C>::Result c_,
			typename traits::add_const_reference<D>::Result d_,
			typename traits::add_const_reference<E>::Result e_,
			typename traits::add_const_reference<F>::Result f_)
			: a(a_), b(b_), c(c_), d(d_), e(e_), f(f_) {}

		void copy(typename traits::add_const_reference<A>::Result a_,
			typename traits::add_const_reference<B>::Result b_,
			typename traits::add_const_reference<C>::Result c_,
			typename traits::add_const_reference<D>::Result d_,
			typename traits::add_const_reference<E>::Result e_,
			typename traits::add_const_reference<F>::Result f_)
		{
			a = a_;
			b = b_;
			c = c_;
			d = d_;
			e = e_;
			f = f_;
		}

		A a;
		B b;
		C c;
		D d;
		E e;
		F f;
	};

	template <typename A, typename B, typename C,typename D, typename E>
	struct Tuple<A, B, C, D, E, void, void, void> 
	{
		Tuple() {}
		Tuple(typename traits::add_const_reference<A>::Result a_,
			typename traits::add_const_reference<B>::Result b_,
			typename traits::add_const_reference<C>::Result c_,
			typename traits::add_const_reference<D>::Result d_,
			typename traits::add_const_reference<E>::Result e_)
			: a(a_), b(b_), c(c_), d(d_), e(e_) {}

		void copy(typename traits::add_const_reference<A>::Result a_,
			typename traits::add_const_reference<B>::Result b_,
			typename traits::add_const_reference<C>::Result c_,
			typename traits::add_const_reference<D>::Result d_,
			typename traits::add_const_reference<E>::Result e_)
		{
			a = a_;
			b = b_;
			c = c_;
			d = d_;
			e = e_;
		}

		A a;
		B b;
		C c;
		D d;
		E e;
	};

	template <typename A, typename B, typename C, typename D>
	struct Tuple<A, B, C, D, void, void, void, void> 
	{
		Tuple() {}
		Tuple(typename traits::add_const_reference<A>::Result a_,
			typename traits::add_const_reference<B>::Result b_,
			typename traits::add_const_reference<C>::Result c_,
			typename traits::add_const_reference<D>::Result d_)
			: a(a_), b(b_), c(c_), d(d_) {}

		void copy(typename traits::add_const_reference<A>::Result a_,
			typename traits::add_const_reference<B>::Result b_,
			typename traits::add_const_reference<C>::Result c_,
			typename traits::add_const_reference<D>::Result d_)
		{
			a = a_;
			b = b_;
			c = c_;
			d = d_;
		}

		A a;
		B b;
		C c;
		D d;
	};

	template <typename A, typename B, typename C>
	struct Tuple<A, B, C, void, void, void, void, void> 
	{
		Tuple() {}
		Tuple(typename traits::add_const_reference<A>::Result a_,
			typename traits::add_const_reference<B>::Result b_,
			typename traits::add_const_reference<C>::Result c_)
			: a(a_), b(b_), c(c_) {}

		void copy(typename traits::add_const_reference<A>::Result a_,
			typename traits::add_const_reference<B>::Result b_,
			typename traits::add_const_reference<C>::Result c_)
		{
			a = a_;
			b = b_;
			c = c_;
		}

		A a;
		B b;
		C c;
	};

	template <typename A, typename B>
	struct Tuple<A, B, void, void, void, void, void, void> 
	{
		Tuple() {}
		Tuple(typename traits::add_const_reference<A>::Result a_,
			typename traits::add_const_reference<B>::Result b_)
			: a(a_), b(b_) {}

		void copy(typename traits::add_const_reference<A>::Result a_,
			typename traits::add_const_reference<B>::Result b_)
		{
			a = a_;
			b = b_;
		}

		A a;
		B b;
	};

	template <typename A>
	struct Tuple<A, void, void, void, void, void, void, void> 
	{
		Tuple() {}
		Tuple(typename traits::add_const_reference<A>::Result a_)
			: a(a_) {}

		void copy(typename traits::add_const_reference<A>::Result a_)
		{
			a = a_;
		}
		A a;
	};

	template <> 
	struct Tuple<void, void, void, void, void, void, void, void> {};
}


#endif //_a78ec1d4_d112_433e_b74f_72ffbee7f1dd__TUPLE_H__